package com.aplana.ccsd.model;

import java.util.Date;

/**
 * Вакансия
 */
public class Vacancy {

	private final String URL;
	private final String title;

	/**
	 * Уровень зарплаты
	 */
	private String salaryLevel;

	/**
	 * Город
	 */
	private String city;

	/**
	 * Требуемый опыт работы
	 */
	private String requiredExperience;

	/**
	 * Общее описание
	 */
	private final String description;

	/**
	 * Обязанности
	 */
	private String responsibility;

	/**
	 * Требования
	 */
	private String requirements;

	/**
	 * Условия
	 */
	private String terms;

	/**
	 * Дата публикации вакансии
	 */
	private Date publicationDate;

	/**
	 * Тип занятости
	 */
	private String employmentType;

	public Vacancy(String title, String description, String uRL) {
		this.title = title;
		this.description = description;
		URL = uRL;
	}

	public String getDescription() {
		return description;
	}

	public String getSalaryLevel() {
		return salaryLevel;
	}

	public void setSalaryLevel(String salaryLevel) {
		this.salaryLevel = salaryLevel;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getRequiredExperience() {
		return requiredExperience;
	}

	public void setRequiredExperience(String requiredExperience) {
		this.requiredExperience = requiredExperience;
	}

	public String getResponsibility() {
		return responsibility;
	}

	public void setResponsibility(String responsibility) {
		this.responsibility = responsibility;
	}

	public boolean isHasResponsibility() {
		return !org.apache.commons.lang.StringUtils.isBlank(responsibility);
	}

	public String getRequirements() {
		return requirements;
	}

	public void setRequirements(String requirements) {
		this.requirements = requirements;
	}

	public boolean isHasRequirements() {
		return !org.apache.commons.lang.StringUtils.isBlank(requirements);
	}

	public String getTerms() {
		return terms;
	}

	public void setTerms(String terms) {
		this.terms = terms;
	}

	public boolean isHasTerms() {
		return !org.apache.commons.lang.StringUtils.isBlank(terms);
	}

	public Date getPublicationDate() {
		return publicationDate;
	}

	public void setPublicationDate(Date publicationDate) {
		this.publicationDate = publicationDate;
	}

	public String getURL() {
		return URL;
	}

	public String getTitle() {
		return title;
	}

	public String getEmploymentType() {
		return employmentType;
	}

	public void setEmploymentType(String employmentType) {
		this.employmentType = employmentType;
	}

	public boolean isHasEmploymentType() {
		return !org.apache.commons.lang.StringUtils.isBlank(employmentType);
	}

	public String getFormatedPublicationDate() {
		if (publicationDate == null) {
			return null;
		}

		return com.aplana.ccsd.util.DateUtils.format(publicationDate);
	}

	public boolean isHasPublicationDate() {
		return publicationDate != null;
	}

	@Override
	public String toString() {
		return "Vacancy [URL=" + URL + ", title=" + title + ", salaryLevel="
				+ salaryLevel + ", city=" + city + ", requiredExperience="
				+ requiredExperience + ", responsibility=" + responsibility
				+ ", requirements=" + requirements + ", terms=" + terms
				+ ", publicationDate=" + publicationDate + "]";
	}

}
